package com.nineclock.approve.nodeResolver.impl;

import cn.hutool.json.JSONObject;
import com.nineclock.approve.nodeResolver.ProcessNodeResolver;
import org.activiti.bpmn.model.Process;
import org.activiti.bpmn.model.StartEvent;

/**
 * 处理 开始节点
 * @author 黑马程序员
 * @Company http://www.ithiema.com
 * @Version 1.0
 */
public class StartNodeResolver extends ProcessNodeResolver {


    /**
     *
     * @param process  流程对象
     * @param currNode  当前节点
     * @param nextNode  下一个节点
     */
    @Override
    public void addFlowNodeToActiviti(Process process, JSONObject currNode, JSONObject nextNode) {
        //绘制开始节点
        StartEvent startEvent = new StartEvent();
        startEvent.setId(getNodeId(currNode));
        startEvent.setName(currNode.getStr("name"));
        //添加到 流程中
        process.addFlowElement(startEvent);

        //添加连线节点
        addSequenceFlow(process, currNode,nextNode);
    }
}
